//package com.gudaomai.wuye.core;
//
//import java.io.IOException;
//import java.io.PrintWriter;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.apache.log4j.LogManager;
//import org.apache.log4j.Logger;
//import org.springframework.security.access.AccessDeniedException;
//import org.springframework.security.web.access.AccessDeniedHandler;
//
//import com.gudaomai.wuye.common.CommonConstant;
//import com.gudaomai.wuye.entity.RetEntity;
//
//
//
///**
// * 拒绝访问
// * @author XueLiang
// * @date 2017年3月1日 上午11:07:10
// * @version 1.0
// */
//public class RestAccessDeniedHandler implements AccessDeniedHandler {
//    
//    private static final Logger LOGGER = LogManager.getLogger(RestAccessDeniedHandler.class);
//
//    @Override
//    public void handle(HttpServletRequest request, HttpServletResponse response,
//            AccessDeniedException accessDeniedException) throws IOException, ServletException {
//        LOGGER.warn("Authentication Failed: " + accessDeniedException.getMessage());
//        RetEntity jsonResponse = new RetEntity();
//        jsonResponse.setRetCode(CommonConstant.RESULT_CODE_EXPECTATION_FAILED);
//        response.addHeader("Content-type", "application/json; charset=UTF-8");
//        response.setCharacterEncoding("UTF-8");
//        PrintWriter printWriter = response.getWriter();
//        printWriter.write(jsonResponse.getRetCode());
//        printWriter.flush();
//        printWriter.close();
//    }
//}
